package zadanie8;

import java.util.Random;


public class Matrix {
	
	int[][] matrix;
	int n;
	int m;
	
	
	
	Matrix(int n, int m) {
		
		this.n = n;
		this.m = m;
		matrix = new int[n][m];
		
		Random random = new Random();
		
		System.out.println("Macierz... " );
		
		for(int i=0; i<n; i++) {
			
			for(int j=0; j<m; j++) {	
				matrix[i][j] = random.nextInt(5);
			}			
			
		}
		
		
	}
	
	public int[][] getMatrix() {
		return matrix;
	}
	@Override
	public String toString() {
		String string = ""; 
		for (int i = 0; i < n; i++) {
		    for (int j = 0; j < n; j++) {
		        string +=   matrix[i][j] + " ";
		    }
		    string +="\n";
		}
		return string;
	}
	
}
